$direction:(l left, r right, t top, b bottom);
@for $i from 1 to 30{
    @each $type in m,p,h,v,a {
        @if $type == m {
            @each $b in $direction {
                [m#{nth($b,1)}#{$i}]{
                    margin-#{nth($b,2)}: #{$i}px;
                }
            }
        }
        @else if $type == p {
            @each $b in $direction {
                [p#{nth($b,1)}#{$i}]{
                    padding-#{nth($b,2)}: #{$i}px;
                }
            }
        }
        @else if $type == h {
            [ph#{$i}]{
                padding-left: #{$i}px;
                padding-right: #{$i}px;
            }
            [mh#{$i}]{
                margin-left: #{$i}px;
                margin-right: #{$i}px;
            }
        }
        @else if $type == v {
            [pv#{$i}]{
                padding-top: #{$i}px;
                padding-bottom: #{$i}px;
            }
        }
        @else {
            [pa#{$i}] {
                padding: #{$i}px;
              }
        }
    }
}